/**
 * Created by baiguiren on 1/23/17.
 */

let async = require('async');

async.series([
  function (callback) {
    // do some stuff ...
    callback(null, 'one');
  },
  function (callback) {
    // do some more stuff ...
    callback(null, 'two');
  }
],
// optional callback
  function (err, result) {
    // result is now equal to ['one', 'two']
    console.log(result);
  }
);


async.series({
  one: function (callback) {
    setTimeout(function () {
      callback(null, 1);
    }, 200);
  },
  two: function (callback) {
    setTimeout(function () {
      callback(null, 2);
    }, 100);
  }
}, function (err, results) {
  // results is now equal to: {one: 1, two: 2}
  console.log(results);
});